/* path.h */

#ifndef PATH_H_FILE
#define PATH_H_FILE

#define PATH_NUM_POINTS    500
#define PATH_NUM_SPAWN_POINTS   16
#define PATH_NUM_SEGS_PER_POINT 16

typedef struct {
  int steps;
  int dest_point;
  int weight;
  int start_level;
} PATH_SEGMENT;

typedef struct {
  int x;
  int y;
  int num_segs;
  PATH_SEGMENT segs[PATH_NUM_SEGS_PER_POINT];
} PATH_POINT;

typedef struct {
  int x;
  int y;
  int radius;
} PATH_STATUE;

typedef struct {
  int bg_num;

  PATH_STATUE statue;

  int num_spawn_points;
  int spawn_points[PATH_NUM_SPAWN_POINTS];

  int num_points;
  PATH_POINT points[PATH_NUM_POINTS];
} PATH;

void path_clear(PATH *path);
int path_is_spawn_point(PATH *path, int point);
void path_remove_spawn_point(PATH *path, int point);
void path_set_spawn_point(PATH *path, int point);
int path_create_point(PATH *path, int x, int y);
void path_move_point(PATH *path, int point_num, int x, int y);
int path_get_point_at(PATH *path, int x, int y);
int path_get_segment_at(PATH *path, int x, int y, int *ppoint, int *psegment);
int path_create_segment(PATH *path, int src_point, int dest_point, int weight);
void path_remove_segment(PATH *path, int point_num, int seg_num);
void path_remove_point(PATH *path, int point_num);
int path_get_segment_endpoints(PATH *path, int point_num, int segment_num, int *x1, int *y1, int *x2, int *y2);
int path_export(PATH *path, const char *filename);
int path_import(PATH *path, const char *filename, char *name, int max_name_len);

#endif /* PATH_H_FILE */
